var xmlProxy;
var VehicleInfoPage = Objs("view.components.VehicleInfoPage",
	UiComponent,
{   
   	vModelComp:null,
	vPhoneComp:null,
	registerpnote:null,
	initialize: function()
	{ 
		VehicleInfoPage.$super.initialize.call( this );
		thisvInfo = this;
		this.initializeChildren();
		this.bindListeners();
	},
	
    initializeChildren: function()
    {
		this.vModelComp = jQuery("#v_make");
		this.vPhoneComp = jQuery("#v_phone");
		this.registerpnote = jQuery("#pnoteaddvinfo");
		
    },

	bindListeners: function()
	{
		var namespace = ".VehicleInfoPage";
   		this.vModelComp.on( "change"+namespace, jQuery.proxy( this, "v_modelComp_clickHandler" ) );
		this.vPhoneComp.on( "click"+namespace, jQuery.proxy( this, "v_phoneComp_clickHandler" ) );
		this.registerpnote .on( "click"+namespace, jQuery.proxy( this, "v_rpnote_clickHandler" ) );
	},

	v_rpnote_clickHandler:function()
	{
	
		this.dispatchEvent( VehicleInfoPage.ADD_PNOTE );	
	},
	v_modelComp_clickHandler: function()
	{  
		var makeField = document.getElementById('v_make').value;
		$(xmld).find('make').each(function(){
			//alert(makeField);
			$(this).find('label').each(function(){
				if($(this).text()==makeField)
				{
					var datafield=$(this).attr('dataField');
					$('select#v_model').empty();
					var modelxml = '<option value="0">--Choose One--</option>';
					$(xmld).find(datafield).each(function(){
						$(this).find('item').each(function(){
							$(this).find('label').each(function(){
								var models = $(this).text();
								modelxml += '<option>'+models+'</option>';
							});
						});
					});
					
					$('select#v_model').append(modelxml);
					$("select#v_model").trigger("change");
				}
			});
		
		});
	},
	v_phoneComp_clickHandler: function()
	{
		
	}

});
VehicleInfoPage.ADD_PNOTE ="addPNote";
